<!DOCTYPE html><!--HTML5 doctype-->
<html>
<head>
<title>Your New Application</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> 
<style type="text/css">
    /* Prevent copy paste for all elements except text fields */
    *  { -webkit-user-select:none; -webkit-tap-highlight-color:rgba(255, 255, 255, 0); }
    input, textarea  { -webkit-user-select:text; }
    
    /* Set up the page with a default background image */
    body {
        background-color:#fff;
        color:#000;
        font-family:Arial;
        font-size:36pt;
        margin:0px;padding:0px;
        background-image:url('images/background.jpg');

    }

    input[type=text], input[type=email], input[type=password] {
        font-size:24pt;
    } 

    button {
        font-size: 56px;
    }
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> 
<script type="text/javascript" charset="utf-8" src="_appMobi/appmobi_local_bootstrap.js"></script> 
<script type="text/javascript" charset="utf-8" src="http://localhost:58888/_appMobi/xhr.js"></script> 
<script type="text/javascript" charset="utf-8" src="http://localhost:58888/_appMobi/appmobi.js"></script>
<script type="text/javascript">
/* This function runs once the page is loaded, but appMobi is not yet active */
var init = function(){

};
window.addEventListener("load",init,false);  

/* This code prevents users from dragging the page */
var preventDefaultScroll = function(event) {
    event.preventDefault();
    window.scroll(0,0);
    return false;
};
document.addEventListener('touchmove', preventDefaultScroll, false);

var currentLatitude = "40.713768";
var currentLongitude = "-73.016696";

var suc = function(p){
    console.log("geolocation success",4);

    currentLatitude = p.coords.latitude;
    currentLongitude = p.coords.longitude;
    console.log("latitude: " + currentLatitude);
    console.log("longitude: " + currentLongitude);
};

var fail = function(){
    console.log("Geolocation failed. \nPlease enable GPS in Settings.",1);
};


/* This code is used to run as soon as appMobi activates */
function onDeviceReady()
    {
        try
        {
            /*if (AppMobi.device.platform.indexOf("Android")!=-1)
            {
                AppMobi.display.useViewport(480,480);
                //document.getElementById("map_canvas").style.width="480px";
            }
            else if (AppMobi.device.platform.indexOf("iOS")!=-1)
            {
                if (AppMobi.device.model.indexOf("iPhone")!=-1 || AppMobi.device.model.indexOf("iPod")!=-1)
                {
                    AppMobi.display.useViewport(320,320);
                    //document.getElementById("map_canvas").style.width="320px";
                }
                else if (AppMobi.device.model.indexOf("iPad")!=-1)
                {
                    AppMobi.display.useViewport(768,768);
                    //document.getElementById("map_canvas").style.width="768px";
                }
            }*/

            if (AppMobi.geolocation != null)
            {
                AppMobi.geolocation.getCurrentPosition(suc,fail);
            }
        }
        catch(e)
        {
            alert(e.message);
        }

        try
        {
            //lock orientation
            AppMobi.device.setRotateOrientation("portrait");
            AppMobi.device.setAutoRotate(false);
        }
        catch(e) {}

        try
        {
            //manage power
            AppMobi.device.managePower(true,false);
        }
        catch(e) {}
        
        try
        {
            //hide splash screen
            AppMobi.device.hideSplashScreen();
        }
        catch(e) {}     
    }

    //initial event handler to detect when appMobi is ready to roll
    document.addEventListener("appMobi.device.ready",onDeviceReady,false);
</script>
<script type="text/javascript">
    $(document).ready(function(){
        $('#submit').click(function(){
            var complaint = $('#complaint').val();
            var varData = 'complaint=' + complaint + '&userID=' + sessionStorage.userID;
            console.log(varData);
            $.ajax({
                type: "POST",
                url: "http://localhost:8000/Uni/Project/Emailtest/request.php",
                data: varData,
                success: function(data){
                    //alert("complete userID=" + sessionStorage.userID);
                    $("h1").before(data);
                }
            });
        });
    });

</script>

</head>
<body>
        <h1>Request Doctor</h1>
        <form>
            <input type="text" name="complaint" id="complaint" />
            <label for="complaint">Health Complaint</label>
            <br>
        </form>
        <button id="submit">Request Doctor</button>
        <div id="test"></div><a href="index.html">back</a>
    </body>
</html>
